package com.fand.manager.controller;

import javax.annotation.Resource;

import com.fand.stater.context.UserInfoThreadLocal;
import com.fand.stater.model.SysUserDetailDTO;
import com.fand.common.util.ResultHelp;
import com.fand.manager.model.user.SysUserPostDTO;
import com.fand.manager.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author: zhangjiabin
 * Email: javaboyok@163.com
 * CreateDate: 2021/6/18
 * Version: 1.0
 */
@Api(tags = "系统设置")
@RestController
@RequestMapping("/sys-sys")
public class SysController {

    @Resource
    private ISysUserService sysUserService;

    @ApiOperation("修改密码")
    @PostMapping("/updatePwd")
    public ResultHelp<Boolean> updatePwd(@RequestBody SysUserPostDTO sysUserPostDTO){
        SysUserDetailDTO sysUserDetailDTO = UserInfoThreadLocal.get();
        sysUserPostDTO.setId(sysUserDetailDTO.getId());
        return ResultHelp.success(sysUserService.updatePwd(sysUserPostDTO));
    }

}
